"""
Author : 张程东
File : data_deal.py 
"""
import pandas as pd


def deal_data(s, datas):
    x=s[0]
    data_list = x.split()
    while "" in data_list:
        data_list.remove("")
    id=[]
    name=[]

    if len(data_list) == 4:
        id.append(data_list[0])
        id.append(data_list[2])
        name.append(data_list[1])
        name.append(data_list[3])
        info = {
            "student_id": id,
            "student_name": name
        }

    elif len(data_list) == 2:
        id.append(data_list[0])

        name.append(data_list[1])

        info = {
            "student_id": id,
            "student_name": name
        }

    data = pd.DataFrame(data=info)
    datas = pd.concat([datas, data], axis=0, ignore_index=True)
    return datas




#F:\图书馆\数据\04-18教务处信息\成绩\2005副本\2005-JX14-0215-001.xlsx
path=r"F:\图书馆\数据\04-18教务处信息\成绩\2005副本\2005-JX14-0215-001.xlsx"
data=pd.read_excel(path,header=None)
data.dropna(axis=0,inplace=True)
student_data=data.loc[2:,:]
s=pd.DataFrame(columns=['student_id','student_name'])
# print(student_data[0])
data=student_data[0].str.split(" ",expand=True)
print(data)
